#include "include.h"
#include "model/elementcontainer.h"

#include "compile/debug_memoryleaks"
using namespace model;

ElementContainer::ElementContainer()
: Element(ElementType_CONTAINER)
{
}

ElementContainer::~ElementContainer()
{
}


void ElementContainer::clear()
{
    child_elements.clear();
}


void ElementContainer::addChild(Element* element)
{
    if (element)
        child_elements.push_back(element);
}

bool ElementContainer::removeChild(Element* element)
{
    if (element)
    {
        std::vector<Element*>::iterator it = child_elements.begin();
        for (it = child_elements.begin(); it!=child_elements.end(); ++it)
        {
            if (element  == (*it))
            {
                child_elements.erase(it);
                return true;
            }
        }
    }
    return false;
}
